#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2021-01-27 17:40
# @Author  : anan
# @Email   : mfkdgefhn@163.com
# @File    : myLogin.py

import scrapy


class MyLoginSpider(scrapy.Spider):

    name = "loginSpider"
    # allowed_domains = ["renren.com"]
    allowed_domains = ['biquyx.com']

    def start_requests(self):
        """ 111 """
        # loginUrl = "http://www.renren.com/ajaxLogin/login"
        loginUrl = "https://www.biquyx.com/Book/getJino.html"

        # formdata = {"email": "mfkdgefhn@163.com",
        #             "password": "mfkdgefhn"},
        yield scrapy.FormRequest(url=loginUrl,
                                 formdata={"type": "mh",
                                           "id": "48",
                                           "p": "1"},
                                 headers={"Content-Type": "application/x-www-form-urlencoded"},
                                 callback=self.parse)
        # 发送post请求，提交表单数据

    def parse(self, response):
        """ 111 """
        print("*****************************************")
        print('*******', response.url)
        print(response.body.decode('utf-8'))
